#include "friendrequestitemwidget.h"
#include "ui_friendrequestitemwidget.h"

FriendRequestItemWidget::FriendRequestItemWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::FriendRequestItemWidget),m_fromId(-1)
{
    ui->setupUi(this);
}

FriendRequestItemWidget::~FriendRequestItemWidget()
{
    delete ui;
}

void FriendRequestItemWidget::setRequestInfo(int fromId, const QString &username, const QString &message)
{
    // 保存ID
    m_fromId = fromId;
    // 更新UI显示
    ui->usernameLabel->setText(username);
    ui->messageLabel->setText(message);
}

void FriendRequestItemWidget::on_acceptpushButton_clicked()
{
    emit accepted(m_fromId);
    return ;
}


void FriendRequestItemWidget::on_rejectpushButton_clicked()
{
    emit rejected(m_fromId);
    return ;
}

